﻿@using System.Diagnostics
@using Ecommerce.Controllers
@using Ecommerce.Models
@using Library
@using Library.Models
@using Library.MVCHelpers
@model ProductViewModel

@{
    var modelCulture = ViewBag.ModelCulture as ProductCulture;
    Debug.Assert(modelCulture != null, "modelCulture != null");

    ViewBag.Title = modelCulture.WebTitle;
    ViewBag.Keywords = modelCulture.Keywords;
    ViewBag.Description = modelCulture.WebDescription;
    Layout = "~/Views/Shared/_Layout.cshtml";

    var productCategoryCulture = Model.ProductCategory.ProductCategoryCultures.SingleOrDefault(i => i.Culture == NOWCulture.CurrentCulture) ?? Model.ProductCategory.ProductCategoryCultures.First();
    var brandCulture = Model.Brand.BrandCultures.SingleOrDefault(i => i.Culture == NOWCulture.CurrentCulture) ?? Model.Brand.BrandCultures.First();

    var breadcrumb = new[]
    {
        new BreadcrumbViewModel("/", NOWCulture.GetString("Home")),
        new BreadcrumbViewModel("/" + productCategoryCulture.Url, productCategoryCulture.Name, "h2"),
        new BreadcrumbViewModel("/" + productCategoryCulture.Url + "-" + brandCulture.Url, brandCulture.Name),
        new BreadcrumbViewModel("/" + productCategoryCulture.Url + "/" + modelCulture.Url, modelCulture.Name, true, "h2")
    };
}

@Html.Action("Breadcrumb", "Shared", new { breadcrumb })

<h1>@modelCulture.Name</h1>
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
            @Html.Action("Gallery", new { product = Model })
        </div>
        <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
            @Html.Action("Scope", new { product = Model })
        </div>
    </div>
    <div class="row product-section">
        <div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
            <h4>@string.Format(NOWCulture.GetString("{0} highlights"), @modelCulture.Name)</h4>
            @Html.Raw(modelCulture.SmallArticle)
            @Html.Action("Specifications", new {product = Model})
        </div>
        <div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
        </div>
    </div>
    <div class="row">
        <article class="product-article">            
            @Html.Raw(ViewHelper.RebuildHTMLContent(modelCulture.Article))
        </article>
    </div>
</div>
@section styles
{
    @Styles.Render("~/Content/product")
}
@section scripts
{
    @(HttpContext.Current.IsDebuggingEnabled ? Scripts.Render("~/bundles/product") : Scripts.RenderFormat(@"<script src=""{0}"" async defer></script>", "~/bundles/product"))
}
